package com.sophialex.health.record.ui.pregnant;

import java.util.ArrayList;
import java.util.List;

import org.eclipse.jface.action.IMenuManager;
import org.eclipse.jface.action.IToolBarManager;
import org.eclipse.swt.SWT;
import org.eclipse.swt.custom.ScrolledComposite;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.layout.FillLayout;
import org.eclipse.swt.layout.FormAttachment;
import org.eclipse.swt.layout.FormData;
import org.eclipse.swt.layout.FormLayout;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Combo;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.DateTime;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Group;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Text;
import org.eclipse.swt.widgets.ToolBar;
import org.eclipse.swt.widgets.ToolItem;
import org.eclipse.ui.forms.widgets.FormToolkit;
import org.eclipse.ui.forms.widgets.Hyperlink;
import org.eclipse.ui.forms.widgets.ScrolledForm;
import org.eclipse.ui.forms.widgets.Section;
import org.eclipse.ui.part.ViewPart;

import com.sophialex.health.record.Messages;
import com.sophialex.health.record.common.draw.DesignUI;
import com.sophialex.health.record.common.draw.UIFormAttachment;
import com.sophialex.health.record.common.utils.CommonUtils;
import com.sophialex.health.record.common.utils.ImageUtil;

/**
 * 孕妇档案登记
 * <p>
 * Title:Health
 * </p>
 * <p>
 * PregnantRecordUI
 * </p>
 * Alex May 26, 2011 3:03:15 PM create
 * 
 * @author <a href='wanghao924@126.com'>Alex</a> QQ: 873987060;
 * @version 1.0
 */
public abstract class PregnantRecordUI extends ViewPart {
	public static final String ID = "com.sophialex.health.record.ui.pregnant.PregnantRecordUI";

	private final FormToolkit toolkit = new FormToolkit(Display.getCurrent());

	private Label lb_name, lb_sex, lb_birthday, lb_lxdh, lb_tc, lb_cc, lb_mcyj, lb_ycq, lb_cjyz, lb_jcrq, lb_chxyd, lb_whcd, lb_yfjzs;

	private Label lb_zfwhcd, lb_zfjb, lb_xysj, lb_lc, lb_yc, lb_ptt, lb_st, lb_zc, lb_nc, lb_jxe, lb_gwy, lb_jwbs, lb_ycqk, lb_sg, lb_tz, lb_xy, lb_tzyc;

	private Label lb_sjj, lb_jj, lb_wj, lb_jjj, lb_xhdb, lb_xt, lb_HbsAg, lb_mdsc, lb_hivsc, lb_ggn, lb_ndb, lb_ndbjcz, lb_fkjc, lb_gwpd, lb_yxjy, lb_yyrq,
			lb_jyr;

	protected Text txt_name; // 姓名

	protected Combo combo_sex; // 性别

	protected DateTime date_birthday; // 出生日期

	protected Text txt_lxdh; // 联系电话

	protected Text txt_tc; // 胎次

	protected Text txt_cc; // 产次

	protected Text txt_mcyj; // 末次月经

	protected DateTime date_ycq; // 预产期

	protected Text txt_cjyz; // 初检孕周

	protected Text txt_chxyd; // 产后休养地址

	protected DateTime date_jcrq; // 建册日期

	protected Combo combo_whcd; // 文化程度 孕妇

	private Hyperlink choosePregnant;

	protected Text txt_jzsjx; // 畸形 孕妇家族史

	protected Text txt_jzsycxjb; // 遗传性疾病 孕妇家族史

	protected Text txt_jzsqt; // 其他 孕妇家族史

	protected Combo combo_zfwhcd; // 文化程度 丈夫

	protected Text txt_zfjzsjx; // 畸形 丈夫

	protected Text txt_zfjzsycxjb; // 遗传性疾病 丈夫

	protected Text txt_zfjzsqt; // 其他 丈夫

	protected Combo combo_xusj; // 需要一小时以上

	protected Text txt_zrlc; // 自然流产

	protected Text txt_rglc; // 人工流产

	protected Text txt_yc; // 引产

	protected Text txt_ptt; // 葡萄胎

	protected Text txt_st; // 死胎

	protected Text txt_zc; // 早产

	protected Text txt_nc; // 难产

	protected Text txt_syjxe; // 生育畸形儿

	protected Text txt_gwy; // 宫外孕

	protected Text txt_ycqkqt; // 其他 本次妊娠早孕期异常情况

	protected Text txt_sg; // 身高

	protected Text txt_tz; // 体重

	protected Text txt_xy; // 血压

	protected Combo combo_tzyc; // 听诊异常

	protected Text txt_tzyc; // 听诊异常 异常

	protected Text txt_sjj; // 髂前上棘间径

	protected Text txt_jj; // 髂棘间径

	protected Text txt_wj; // 骶耻外径

	protected Text txt_jjj; // 坐骨结节间径

	protected Text txt_xhdb; // 血红蛋白

	protected Text txt_xt; // 血糖

	protected Combo combo_ggn; // 肝功能

	protected Text txt_ggn; // 肝功能 异常

	protected Combo combo_HbsAg; // HbsAg

	protected Combo combo_mdsc; // 梅毒筛查

	protected Combo combo_hivsc; // HIV筛查

	protected Combo cmobo_ndb; // 尿蛋白

	protected Text txt_ndbjcz; // 尿蛋白 检测值

	protected Combo cmobo_fkjc; // 妇科检查

	protected Text txt_fkjc; // 妇科检查 异常

	protected Combo cmobo_gwpd; // 高危评定

	protected DateTime date_yyrq; // 预约日期

	protected Text txt_yxjy; // 医学建议

	protected Text txt_jcr; // 检查人

	public PregnantRecordUI() {
	}

	private Composite composite_1;

	protected ToolItem toolItemEdit;

	protected ToolItem toolItemDel;

	protected ToolItem toolItemSave;

	protected ToolItem toolItemCancel;

	protected ToolItem toolItemAdd;

	protected ToolItem toolItemExit;

	protected enum PregnantRecordUIState {
		ADD_VIEW, EDIT_VIEW, SHOW_VIEW;
	}

	/**
	 * Create contents of the view part.
	 * 
	 * @param parent
	 */
	@Override
	public void createPartControl(Composite parent) {
		Composite container = new Composite(parent, SWT.NONE);
		container.setLayout(new FormLayout());
		{
			composite_1 = new Composite(container, SWT.NONE);
			composite_1.setLayout(new FillLayout(SWT.HORIZONTAL));
			{
				FormData formData = new FormData();
				formData.height = 50;
				formData.right = new FormAttachment(100);
				formData.top = new FormAttachment(0);
				formData.left = new FormAttachment(0);
				composite_1.setLayoutData(formData);
			}
			{
				ToolBar toolBar = new ToolBar(composite_1, SWT.FLAT | SWT.NONE);
				toolBar.setBackgroundImage(ImageUtil.TBBJ);
				// {
				// toolItemAdd = new ToolItem(toolBar, SWT.NONE);
				//					toolItemAdd.setText(Messages.getString("RecordUI.0")); //$NON-NLS-1$
				// toolItemAdd.setImage(ImageUtil.add);
				// toolItemAdd.addSelectionListener(new SelectionAdapter() {
				// @Override
				// public void widgetSelected(SelectionEvent e) {
				// doAdd();
				// }
				// });
				// }
				{
					toolItemEdit = new ToolItem(toolBar, SWT.NONE);
					toolItemEdit.setText(Messages.getString("RecordUI.1")); //$NON-NLS-1$
					toolItemEdit.setImage(ImageUtil.edit);
					toolItemEdit.addSelectionListener(new SelectionAdapter() {
						@Override
						public void widgetSelected(SelectionEvent e) {
							doEdit();
						}
					});
				}
				{
					toolItemDel = new ToolItem(toolBar, SWT.NONE);
					toolItemDel.setText(Messages.getString("RecordUI.2")); //$NON-NLS-1$
					toolItemDel.setImage(ImageUtil.delete);
					toolItemDel.addSelectionListener(new SelectionAdapter() {
						@Override
						public void widgetSelected(SelectionEvent e) {
							doDel();
						}
					});
				}
				{
					@SuppressWarnings("unused")
					ToolItem toolItem = new ToolItem(toolBar, SWT.SEPARATOR);
				}
				{
					toolItemSave = new ToolItem(toolBar, SWT.NONE);
					toolItemSave.setText(Messages.getString("RecordUI.3")); //$NON-NLS-1$
					toolItemSave.addSelectionListener(new SelectionAdapter() {
						@Override
						public void widgetSelected(SelectionEvent e) {
							doSave();
						}
					});
					toolItemSave.setImage(ImageUtil.save);
				}

				{
					toolItemCancel = new ToolItem(toolBar, SWT.NONE);
					toolItemCancel.setText(Messages.getString("RecordUI.4")); //$NON-NLS-1$
					toolItemCancel.addSelectionListener(new SelectionAdapter() {
						@Override
						public void widgetSelected(SelectionEvent e) {
							doCancel();
						}
					});
					toolItemCancel.setImage(ImageUtil.cancel);
				}
				{
					toolItemExit = new ToolItem(toolBar, SWT.NONE);
					toolItemExit.setText(Messages.getString("RecordUI.6")); //$NON-NLS-1$
					toolItemExit.addSelectionListener(new SelectionAdapter() {
						@Override
						public void widgetSelected(SelectionEvent e) {
							doExit();
						}
					});
					toolItemExit.setImage(ImageUtil.exit);
				}
				/*
				 * { ToolItem toolItem = new ToolItem(toolBar, SWT.NONE);
				 * toolItem.setText(Messages.getString("RecordUI.5"));
				 * //$NON-NLS-1$ toolItem.setImage(ImageUtil.print);
				 * toolItem.addSelectionListener(new SelectionAdapter() {
				 * 
				 * @Override public void widgetSelected(SelectionEvent e) {
				 * doPrint(); } }); }
				 */
			}
		}

		{
			Composite composite = new Composite(container, SWT.NONE);
			{
				FormData formData = new FormData();
				formData.top = new FormAttachment(composite_1, 0);
				formData.bottom = new FormAttachment(100, -4);
				formData.right = new FormAttachment(composite_1, 0, SWT.RIGHT);
				formData.left = new FormAttachment(composite_1, 0, SWT.LEFT);
				composite.setLayout(new FillLayout(SWT.FILL));
				composite.setLayoutData(formData);

			}
			drawUI(composite);
		}
		initCombo();
		createActions();
		initializeToolBar();
		initializeMenu();

		this.setPartName(Messages.getString("PregnantRecord.Title")); //$NON-NLS-1$

	}

	// 绘制界面
	private void drawUI(Composite parent) {

		ScrolledComposite scrolledComposite = new ScrolledComposite(parent, SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL);
		toolkit.adapt(scrolledComposite);
		toolkit.paintBordersFor(scrolledComposite);
		scrolledComposite.setExpandHorizontal(true);
		scrolledComposite.setExpandVertical(true);

		ScrolledForm scrldfrmNewScrolledform = toolkit.createScrolledForm(scrolledComposite);
		toolkit.paintBordersFor(scrldfrmNewScrolledform);
		scrldfrmNewScrolledform.setText("   姓名：张三             个人档案编号：152877552142211");
		scrldfrmNewScrolledform.getBody().setLayout(new FormLayout());

		// 基本信息
		UIFormAttachment fzjcsectionUIAttachment = UIFormAttachment.getDefault(12);
		Section jbxxSection = DesignUI.drawSection(toolkit, scrldfrmNewScrolledform, fzjcsectionUIAttachment, "基本信息", false);
		Composite composite_jbxx = DesignUI.drawSectionComposite(toolkit, jbxxSection);

		List<Control[]> jbxxcontrolList = new ArrayList<Control[]>();
		// 姓名
		{
			lb_name = toolkit.createLabel(composite_jbxx, "    姓名：", SWT.NONE);
			txt_name = toolkit.createText(composite_jbxx, "", SWT.NONE);
			choosePregnant = toolkit.createHyperlink(composite_jbxx, "选择", SWT.NONE);
			choosePregnant.setToolTipText("选择孕妇");
			Control[] controls = { lb_name, txt_name, choosePregnant };
			jbxxcontrolList.add(controls);
		}
		// 性别
		{
			lb_sex = toolkit.createLabel(composite_jbxx, "  性别：", SWT.NONE);
			combo_sex = new Combo(composite_jbxx, SWT.READ_ONLY);
			Control[] controls = { lb_sex, combo_sex };
			jbxxcontrolList.add(controls);
		}
		// 出生日期
		{
			lb_birthday = toolkit.createLabel(composite_jbxx, "出生日期：", SWT.NONE);
			date_birthday = new DateTime(composite_jbxx, SWT.BORDER | SWT.DROP_DOWN);
			Control[] controls = { lb_birthday, date_birthday };
			jbxxcontrolList.add(controls);
		}
		// 联系电话
		{
			lb_lxdh = toolkit.createLabel(composite_jbxx, "联系电话：", SWT.NONE);
			txt_lxdh = toolkit.createText(composite_jbxx, "", SWT.NONE);
			Control[] controls = { lb_lxdh, txt_lxdh };
			jbxxcontrolList.add(controls);
		}
		// 胎次
		{
			lb_tc = toolkit.createLabel(composite_jbxx, "胎次：", SWT.NONE);
			txt_tc = toolkit.createText(composite_jbxx, "", SWT.NONE);
			Control[] controls = { lb_tc, txt_tc };
			jbxxcontrolList.add(controls);
		}
		// 产次
		{
			lb_cc = toolkit.createLabel(composite_jbxx, "产次：", SWT.NONE);
			txt_cc = toolkit.createText(composite_jbxx, "", SWT.NONE);
			Control[] controls = { lb_cc, txt_cc };
			jbxxcontrolList.add(controls);
		}
		// 末次月经
		{
			lb_mcyj = toolkit.createLabel(composite_jbxx, "末次月经：", SWT.NONE);
			txt_mcyj = toolkit.createText(composite_jbxx, "", SWT.NONE);
			Control[] controls = { lb_mcyj, txt_mcyj };
			jbxxcontrolList.add(controls);
		}
		// 初检孕周
		{
			lb_cjyz = toolkit.createLabel(composite_jbxx, "初检孕周：", SWT.NONE);
			txt_cjyz = toolkit.createText(composite_jbxx, "", SWT.NONE);
			Control[] controls = { lb_cjyz, txt_cjyz };
			jbxxcontrolList.add(controls);
		}
		// 预产期
		{
			lb_ycq = toolkit.createLabel(composite_jbxx, "预产期：", SWT.NONE);
			date_ycq = new DateTime(composite_jbxx, SWT.BORDER | SWT.DROP_DOWN);
			toolkit.adapt(date_ycq, true, true);
			Control[] controls = { lb_ycq, date_ycq };
			jbxxcontrolList.add(controls);
		}

		// 建册日期
		{
			lb_jcrq = toolkit.createLabel(composite_jbxx, "建册日期：", SWT.NONE);
			date_jcrq = new DateTime(composite_jbxx, SWT.BORDER | SWT.DROP_DOWN);
			toolkit.adapt(date_jcrq, true, true);
			Control[] controls = { lb_jcrq, date_jcrq };
			jbxxcontrolList.add(controls);
		}
		DesignUI.drawSecionContent(composite_jbxx, jbxxcontrolList, 4, true, null);

		// 产后休养地址
		{
			lb_chxyd = toolkit.createLabel(composite_jbxx, "产后休养地址：", SWT.NONE);
			txt_chxyd = toolkit.createText(composite_jbxx, "", SWT.NONE);
			Control[] controls = { lb_chxyd, txt_chxyd };
			DesignUI.drawItem(composite_jbxx, controls, false, true, lb_mcyj, txt_cjyz);
		}

		Group ybqkgroup = new Group(composite_jbxx, SWT.NONE);
		FormData fd_group = new FormData();
		fd_group.top = new FormAttachment(lb_ycq, 40, SWT.TOP);
		fd_group.left = new FormAttachment(0);
		fd_group.right = new FormAttachment(100);
		fd_group.bottom = new FormAttachment(lb_ycq, 170, SWT.BOTTOM);
		ybqkgroup.setLayoutData(fd_group);
		ybqkgroup.setText("一般情况");
		ybqkgroup.setLayout(new FormLayout());

		// 文化程度
		{
			lb_whcd = toolkit.createLabel(ybqkgroup, "  孕妇文化程度：", SWT.NONE);
			combo_whcd = new Combo(ybqkgroup, SWT.READ_ONLY);
			Control[] controls = { lb_whcd, combo_whcd };
			DesignUI.drawItem(ybqkgroup, controls, true, false, null);
		}
		// 孕妇家族史
		{
			lb_yfjzs = toolkit.createLabel(ybqkgroup, "孕妇家族史：", SWT.NONE);
			FormData fd_yfjzs = new FormData();
			fd_yfjzs.left = new FormAttachment(combo_whcd, 40);
			fd_yfjzs.bottom = new FormAttachment(lb_whcd, 0, SWT.BOTTOM);
			lb_yfjzs.setLayoutData(fd_yfjzs);
		}
		Button[] yjJzsButtons = CommonUtils.initCheckBoxUI(toolkit, ybqkgroup, lb_yfjzs, "YFJZS", new int[] { 15, 15, 110, 110, 110 }, null, "drinkWater");

		txt_jzsjx = toolkit.createText(ybqkgroup, "", SWT.NONE);
		txt_jzsycxjb = toolkit.createText(ybqkgroup, "", SWT.NONE);
		txt_jzsqt = toolkit.createText(ybqkgroup, "", SWT.NONE);
		DesignUI.drawAddTo(yjJzsButtons[2], txt_jzsjx, 1, combo_whcd, 90);
		DesignUI.drawAddTo(yjJzsButtons[3], txt_jzsycxjb, 1, combo_whcd, 90);
		DesignUI.drawAddTo(yjJzsButtons[4], txt_jzsqt, 1, combo_whcd, 90);

		// 文化程度 丈夫
		{
			lb_zfwhcd = toolkit.createLabel(ybqkgroup, "  丈夫文化程度：", SWT.NONE);
			combo_zfwhcd = new Combo(ybqkgroup, SWT.READ_ONLY);
			Control[] controls = { lb_zfwhcd, combo_zfwhcd };
			DesignUI.drawItem(ybqkgroup, controls, true, true, lb_whcd);
		}

		// 孕妇家族史
		{
			lb_zfjb = toolkit.createLabel(ybqkgroup, "存在下列情况：", SWT.NONE);
			FormData fd_yfjzs = new FormData();
			fd_yfjzs.right = new FormAttachment(lb_yfjzs, 0, SWT.RIGHT);
			fd_yfjzs.bottom = new FormAttachment(lb_zfwhcd, 0, SWT.BOTTOM);
			lb_zfjb.setLayoutData(fd_yfjzs);
		}
		txt_zfjzsjx = toolkit.createText(ybqkgroup, "", SWT.NONE);
		txt_zfjzsycxjb = toolkit.createText(ybqkgroup, "", SWT.NONE);
		txt_zfjzsqt = toolkit.createText(ybqkgroup, "", SWT.NONE);
		Button[] zfJzsButtons = CommonUtils.initCheckBoxUI(toolkit, ybqkgroup, lb_zfjb, "YFJZS", new int[] { 15, 15, 110, 110, 110 }, null, "drinkWater");
		DesignUI.drawAddTo(zfJzsButtons[2], txt_zfjzsjx, 1, combo_zfwhcd, 90);
		DesignUI.drawAddTo(zfJzsButtons[3], txt_zfjzsycxjb, 1, combo_zfwhcd, 90);
		DesignUI.drawAddTo(zfJzsButtons[4], txt_zfjzsqt, 1, combo_zfwhcd, 90);

		// 使用当地和家庭可得的交通工具，由居住地点到乡镇卫生院至少需要一小时以上
		{
			lb_xysj = toolkit.createLabel(ybqkgroup, "  使用当地和家庭可得的交通工具，由居住地点到乡镇卫生院至少需要一小时以上：", SWT.NONE);
			combo_xusj = new Combo(ybqkgroup, SWT.READ_ONLY);
			Control[] controls = { lb_xysj, combo_xusj };
			DesignUI.drawItem(ybqkgroup, controls, true, true, lb_zfwhcd);
		}

		// 检查情况
		UIFormAttachment jcqksectionUIAttachment = UIFormAttachment.getDefault(jbxxSection, 20, 0, false);
		Section jcqkSection = DesignUI.drawSection(toolkit, scrldfrmNewScrolledform, jcqksectionUIAttachment, "检查情况", true);
		Composite composite_jcqk = DesignUI.drawSectionComposite(toolkit, jcqkSection);

		Group ycycsgroup = new Group(composite_jcqk, SWT.NONE);
		FormData fd_ycycs = new FormData();
		fd_ycycs.top = new FormAttachment(0, 20);
		fd_ycycs.left = new FormAttachment(0);
		fd_ycycs.right = new FormAttachment(100);
		fd_ycycs.bottom = new FormAttachment(0, 130);
		ycycsgroup.setLayoutData(fd_ycycs);
		ycycsgroup.setText("异常孕产史");
		ycycsgroup.setLayout(new FormLayout());
		List<Control[]> ycycscontrolList = new ArrayList<Control[]>();
		// 流产
		{
			lb_lc = toolkit.createLabel(ycycsgroup, "  流产（自然/人工）：", SWT.NONE);
			txt_zrlc = toolkit.createText(ycycsgroup, "", SWT.NONE);
			Label ci = toolkit.createLabel(ycycsgroup, "次 /", SWT.NONE);
			Label ci2 = toolkit.createLabel(ycycsgroup, " 次", SWT.NONE);
			txt_rglc = toolkit.createText(ycycsgroup, "", SWT.NONE);
			Control[] controls = { lb_lc, txt_zrlc, ci, txt_rglc };
			DesignUI.wightmargin = 1;
			DesignUI.drawItem(ycycsgroup, controls, true, false, null, 66);
			DesignUI.reset();
			DesignUI.drawAddTo(txt_rglc, ci2, 0);
		}

		// 引产
		{
			lb_yc = toolkit.createLabel(ycycsgroup, " 引产：", SWT.NONE);
			txt_yc = toolkit.createText(ycycsgroup, "", SWT.NONE);
			Label ci = toolkit.createLabel(ycycsgroup, "次", SWT.NONE);
			Control[] controls = { lb_yc, txt_yc, ci };
			DesignUI.drawItem(ycycsgroup, controls, false, false, txt_rglc);
		}
		// 葡萄胎
		{
			lb_ptt = toolkit.createLabel(ycycsgroup, " 葡萄胎：", SWT.NONE);
			txt_ptt = toolkit.createText(ycycsgroup, "", SWT.NONE);
			Label ci = toolkit.createLabel(ycycsgroup, "次", SWT.NONE);
			Control[] controls = { lb_ptt, txt_ptt, ci };
			DesignUI.drawItem(ycycsgroup, controls, false, false, txt_yc);
		}
		// 死胎
		{
			lb_st = toolkit.createLabel(ycycsgroup, " 死胎：", SWT.NONE);
			txt_st = toolkit.createText(ycycsgroup, "", SWT.NONE);
			Label ci = toolkit.createLabel(ycycsgroup, "次", SWT.NONE);
			Control[] controls = { lb_st, txt_st, ci };
			DesignUI.drawItem(ycycsgroup, controls, false, false, txt_ptt);
		}
		// 早产
		{
			lb_zc = toolkit.createLabel(ycycsgroup, " 早产：", SWT.NONE);
			txt_zc = toolkit.createText(ycycsgroup, "", SWT.NONE);
			Label ci = toolkit.createLabel(ycycsgroup, "次", SWT.NONE);
			Control[] controls = { lb_zc, txt_zc, ci };
			ycycscontrolList.add(controls);
		}
		// 难产
		{
			lb_nc = toolkit.createLabel(ycycsgroup, " 难产：", SWT.NONE);
			txt_nc = toolkit.createText(ycycsgroup, "", SWT.NONE);
			Label ci = toolkit.createLabel(ycycsgroup, "次", SWT.NONE);
			Control[] controls = { lb_nc, txt_nc, ci };
			ycycscontrolList.add(controls);
		}
		// 生育畸形儿
		{
			lb_jxe = toolkit.createLabel(ycycsgroup, "生育畸形儿：", SWT.NONE);
			txt_syjxe = toolkit.createText(ycycsgroup, "", SWT.NONE);
			Label ci = toolkit.createLabel(ycycsgroup, "次", SWT.NONE);
			Control[] controls = { lb_jxe, txt_syjxe, ci };
			ycycscontrolList.add(controls);
		}
		// 宫外孕
		{
			lb_gwy = toolkit.createLabel(ycycsgroup, "宫外孕：", SWT.NONE);
			txt_gwy = toolkit.createText(ycycsgroup, "", SWT.NONE);
			Label ci = toolkit.createLabel(ycycsgroup, "次", SWT.NONE);
			Control[] controls = { lb_gwy, txt_gwy, ci };
			ycycscontrolList.add(controls);
		}
		Control[] refer = { lb_lc, lb_yc, lb_ptt, lb_st };
		DesignUI.drawRow(ycycsgroup, ycycscontrolList, refer, false);

		// 孕妇既往病史
		{
			lb_jwbs = toolkit.createLabel(composite_jcqk, "  既往病史：", SWT.NONE);
			FormData fd_jwbs = new FormData();
			fd_jwbs.left = new FormAttachment(0);
			fd_jwbs.top = new FormAttachment(ycycsgroup, 40);
			lb_jwbs.setLayoutData(fd_jwbs);
			Button[] jwbsButtons = CommonUtils.initCheckBoxUI(toolkit, composite_jcqk, lb_jwbs, "YFJWS", new int[] { 15 }, null, "drinkWater");
		}

		// 本次妊娠早孕期异常情况
		{
			lb_ycqk = toolkit.createLabel(composite_jcqk, "  本次妊娠早孕期异常情况：", SWT.NONE);
			FormData fd_ycqk = new FormData();
			fd_ycqk.left = new FormAttachment(0);
			fd_ycqk.top = new FormAttachment(lb_jwbs, 40);
			lb_ycqk.setLayoutData(fd_ycqk);
			Button[] ycqkButtons = CommonUtils.initCheckBoxUI(toolkit, composite_jcqk, lb_ycqk, "ZYYCQK", new int[] { 10 }, null, "drinkWater");
			txt_ycqkqt = toolkit.createText(composite_jcqk, "", SWT.NONE);
			DesignUI.drawAddTo(ycqkButtons[ycqkButtons.length - 1], txt_ycqkqt, 2, lb_ycqk, 106);
		}

		Group tgjcgroup = new Group(composite_jcqk, SWT.NONE);
		FormData fd_tgjc = new FormData();
		fd_tgjc.top = new FormAttachment(lb_ycqk, 40, SWT.TOP);
		fd_tgjc.left = new FormAttachment(0);
		fd_tgjc.right = new FormAttachment(100);
		fd_tgjc.bottom = new FormAttachment(lb_ycqk, 110);
		tgjcgroup.setLayoutData(fd_tgjc);
		tgjcgroup.setText("体格检查");
		tgjcgroup.setLayout(new FormLayout());
		List<Control[]> tgjccontrolList = new ArrayList<Control[]>();

		// 身高
		{
			lb_sg = toolkit.createLabel(tgjcgroup, "              身高：", SWT.NONE);
			txt_sg = toolkit.createText(tgjcgroup, "", SWT.NONE);
			Label lm = toolkit.createLabel(tgjcgroup, "cm", SWT.NONE);
			Control[] controls = { lb_sg, txt_sg, lm };
			tgjccontrolList.add(controls);
		}
		// 体重
		{
			lb_tz = toolkit.createLabel(tgjcgroup, "    体重：", SWT.NONE);
			txt_tz = toolkit.createText(tgjcgroup, "", SWT.NONE);
			Label lm = toolkit.createLabel(tgjcgroup, "kg", SWT.NONE);
			Control[] controls = { lb_tz, txt_tz, lm };
			tgjccontrolList.add(controls);
		}
		// 血压
		{
			lb_xy = toolkit.createLabel(tgjcgroup, "    血压：", SWT.NONE);
			txt_xy = toolkit.createText(tgjcgroup, "", SWT.NONE);
			Label lm = toolkit.createLabel(tgjcgroup, "mmHg", SWT.NONE);
			Control[] controls = { lb_xy, txt_xy, lm };
			tgjccontrolList.add(controls);
		}
		// 心肺听诊异常
		{
			lb_tzyc = toolkit.createLabel(tgjcgroup, "心肺听诊异常：", SWT.NONE);
			combo_tzyc = new Combo(tgjcgroup, SWT.READ_ONLY);
			txt_tzyc = toolkit.createText(tgjcgroup, "", SWT.NONE);
			Control[] controls = { lb_tzyc, combo_tzyc, txt_tzyc };
			tgjccontrolList.add(controls);
		}
		DesignUI.defaultWidth = 100;
		DesignUI.drawSecionContent(tgjcgroup, tgjccontrolList, 4, true, null);
		DesignUI.reset();

		Group pgclgroup = new Group(composite_jcqk, SWT.NONE);
		FormData fd_pgcl = new FormData();
		fd_pgcl.top = new FormAttachment(tgjcgroup, 40);
		fd_pgcl.left = new FormAttachment(0);
		fd_pgcl.right = new FormAttachment(100);
		fd_pgcl.bottom = new FormAttachment(tgjcgroup, 110, SWT.BOTTOM);
		pgclgroup.setLayoutData(fd_pgcl);
		pgclgroup.setText("骨盆测量");
		pgclgroup.setLayout(new FormLayout());
		List<Control[]> pgclcontrolList = new ArrayList<Control[]>();

		// 髂前上棘间径
		{
			lb_sjj = toolkit.createLabel(pgclgroup, "      髂前上棘间径：", SWT.NONE);
			txt_sjj = toolkit.createText(pgclgroup, "", SWT.NONE);
			Label lm = toolkit.createLabel(pgclgroup, "cm", SWT.NONE);
			Control[] controls = { lb_sjj, txt_sjj, lm };
			pgclcontrolList.add(controls);
		}
		// 髂棘间径
		{
			lb_jj = toolkit.createLabel(pgclgroup, "髂棘间径：", SWT.NONE);
			txt_jj = toolkit.createText(pgclgroup, "", SWT.NONE);
			Label lm = toolkit.createLabel(pgclgroup, "kg", SWT.NONE);
			Control[] controls = { lb_jj, txt_jj, lm };
			pgclcontrolList.add(controls);
		}
		// 骶耻外径
		{
			lb_wj = toolkit.createLabel(pgclgroup, "骶耻外径：", SWT.NONE);
			txt_wj = toolkit.createText(pgclgroup, "", SWT.NONE);
			Label lm = toolkit.createLabel(pgclgroup, "mmHg", SWT.NONE);
			Control[] controls = { lb_wj, txt_wj, lm };
			pgclcontrolList.add(controls);
		}
		// 坐骨结节间径
		{
			lb_jjj = toolkit.createLabel(pgclgroup, "坐骨结节间径：", SWT.NONE);
			txt_jjj = toolkit.createText(pgclgroup, "", SWT.NONE);
			Label lm = toolkit.createLabel(pgclgroup, "mmHg", SWT.NONE);
			Control[] controls = { lb_jjj, txt_jjj, lm };
			pgclcontrolList.add(controls);
		}
		DesignUI.defaultWidth = 100;
		DesignUI.drawSecionContent(pgclgroup, pgclcontrolList, 4, true, null);
		DesignUI.reset();

		Group fzjcgroup = new Group(composite_jcqk, SWT.NONE);
		FormData fd_fzjc = new FormData();
		fd_fzjc.top = new FormAttachment(pgclgroup, 40);
		fd_fzjc.left = new FormAttachment(0);
		fd_fzjc.right = new FormAttachment(100);
		fd_fzjc.bottom = new FormAttachment(pgclgroup, 150, SWT.BOTTOM);
		fzjcgroup.setLayoutData(fd_fzjc);
		fzjcgroup.setText("辅助检查");
		fzjcgroup.setLayout(new FormLayout());
		List<Control[]> fzjccontrolList = new ArrayList<Control[]>();
		// 血红蛋白
		{
			lb_xhdb = toolkit.createLabel(fzjcgroup, "          血红蛋白：", SWT.NONE);
			txt_xhdb = toolkit.createText(fzjcgroup, "", SWT.NONE);
			Label lm = toolkit.createLabel(fzjcgroup, "g/L", SWT.NONE);
			Control[] controls = { lb_xhdb, txt_xhdb, lm };
			fzjccontrolList.add(controls);
		}
		// 血糖
		{
			lb_xt = toolkit.createLabel(fzjcgroup, "    血糖：", SWT.NONE);
			txt_xt = toolkit.createText(fzjcgroup, "", SWT.NONE);
			Label lm = toolkit.createLabel(fzjcgroup, "mmol/L", SWT.NONE);
			Control[] controls = { lb_xt, txt_xt, lm };
			fzjccontrolList.add(controls);
		}
		// HbsAg
		{
			lb_HbsAg = toolkit.createLabel(fzjcgroup, "HbsAg：", SWT.NONE);
			combo_HbsAg = new Combo(fzjcgroup, SWT.READ_ONLY);
			Control[] controls = { lb_HbsAg, combo_HbsAg };
			fzjccontrolList.add(controls);
		}
		// 肝功能
		{
			lb_ggn = toolkit.createLabel(fzjcgroup, "          肝功能：", SWT.NONE);
			combo_ggn = new Combo(fzjcgroup, SWT.READ_ONLY);
			txt_ggn = toolkit.createText(fzjcgroup, "", SWT.NONE);
			Control[] controls = { lb_ggn, combo_ggn, txt_ggn };
			fzjccontrolList.add(controls);
		}
		// 梅毒筛查
		{
			lb_mdsc = toolkit.createLabel(fzjcgroup, "梅毒筛查：", SWT.NONE);
			combo_mdsc = new Combo(fzjcgroup, SWT.READ_ONLY);
			Control[] controls = { lb_mdsc, combo_mdsc };
			fzjccontrolList.add(controls);
		}
		// HIV筛查
		{
			lb_hivsc = toolkit.createLabel(fzjcgroup, "HIV筛查：", SWT.NONE);
			combo_hivsc = new Combo(fzjcgroup, SWT.READ_ONLY);
			Control[] controls = { lb_hivsc, combo_hivsc };
			fzjccontrolList.add(controls);
		}

		// 尿蛋白
		{
			lb_ndb = toolkit.createLabel(fzjcgroup, "尿蛋白：", SWT.NONE);
			cmobo_ndb = new Combo(fzjcgroup, SWT.READ_ONLY);
			Control[] controls = { lb_ndb, cmobo_ndb };
			fzjccontrolList.add(controls);
		}

		// 尿蛋白定量检测值
		{
			lb_ndbjcz = toolkit.createLabel(fzjcgroup, "尿蛋白定量检测值：", SWT.NONE);
			txt_ndbjcz = toolkit.createText(fzjcgroup, "", SWT.NONE);
			Label lm = toolkit.createLabel(fzjcgroup, "mg/24h", SWT.NONE);
			Control[] controls = { lb_ndbjcz, txt_ndbjcz, lm };

			fzjccontrolList.add(controls);
		}
		DesignUI.defaultWidth = 100;
		DesignUI.drawSecionContent(fzjcgroup, fzjccontrolList, 4, true, null);
		DesignUI.reset();

		List<Control[]> newLineList = new ArrayList<Control[]>();
		// 妇科检查
		{
			lb_fkjc = toolkit.createLabel(composite_jcqk, "  妇科检查：", SWT.NONE);
			cmobo_fkjc = new Combo(composite_jcqk, SWT.READ_ONLY);
			txt_fkjc = toolkit.createText(composite_jcqk, "", SWT.NONE);
			Control[] controls = { lb_fkjc, cmobo_fkjc, txt_fkjc };
			DesignUI.defaultWidth = 100;
			DesignUI.oneDefaultTop = 140;
			DesignUI.drawItem(composite_jcqk, controls, true, true, fzjcgroup);

		}
		// 高危评定
		{
			lb_gwpd = toolkit.createLabel(composite_jcqk, "高危评定：", SWT.NONE);
			cmobo_gwpd = new Combo(composite_jcqk, SWT.READ_ONLY);
			Control[] controls = { lb_gwpd, cmobo_gwpd };
			DesignUI.drawItem(composite_jcqk, controls, false, false, txt_fkjc);
		}
		// 预约日期
		{
			lb_yyrq = toolkit.createLabel(composite_jcqk, "预约日期：", SWT.NONE);
			date_yyrq = new DateTime(composite_jcqk, SWT.BORDER | SWT.DROP_DOWN);
			Control[] controls = { lb_yyrq, date_yyrq };
			DesignUI.drawItem(composite_jcqk, controls, false, false, cmobo_gwpd);
			toolkit.adapt(date_yyrq, true, true);
		}
		// 医学建议
		{
			lb_yxjy = toolkit.createLabel(composite_jcqk, "医学建议：", SWT.NONE);
			FormData fd_cl = new FormData();
			fd_cl.top = new FormAttachment(lb_fkjc, 40, SWT.TOP);
			fd_cl.right = new FormAttachment(lb_fkjc, 0, SWT.RIGHT);
			lb_yxjy.setLayoutData(fd_cl);

			txt_yxjy = toolkit.createText(composite_jcqk, "", SWT.WRAP | SWT.MULTI | SWT.V_SCROLL);
			FormData fd_txt_cl = new FormData();
			fd_txt_cl.right = new FormAttachment(cmobo_gwpd, 0, SWT.RIGHT);
			fd_txt_cl.top = new FormAttachment(lb_yxjy, 0, SWT.TOP);
			fd_txt_cl.bottom = new FormAttachment(lb_yxjy, 60, SWT.BOTTOM);
			fd_txt_cl.left = new FormAttachment(lb_yxjy, 6);
			txt_yxjy.setLayoutData(fd_txt_cl);
		}
		// 检验人
		{
			lb_jyr = toolkit.createLabel(composite_jcqk, "检验人：", SWT.NONE);
			FormData fd_pgr = new FormData();
			fd_pgr.top = new FormAttachment(lb_yxjy, 0, SWT.TOP);
			fd_pgr.right = new FormAttachment(lb_yyrq, 0, SWT.RIGHT);
			lb_jyr.setLayoutData(fd_pgr);
			txt_jcr = toolkit.createText(composite_jcqk, "", SWT.NONE);
			FormData fd_txt_pgr = new FormData();
			fd_txt_pgr.right = new FormAttachment(lb_jyr, 100, SWT.RIGHT);
			fd_txt_pgr.top = new FormAttachment(lb_jyr, -8, SWT.TOP);
			fd_txt_pgr.bottom = new FormAttachment(lb_jyr, 0, SWT.BOTTOM);
			fd_txt_pgr.left = new FormAttachment(lb_jyr, 6);
			txt_jcr.setLayoutData(fd_txt_pgr);
		}

		scrolledComposite.setContent(scrldfrmNewScrolledform);
		scrolledComposite.setMinSize(scrldfrmNewScrolledform.computeSize(SWT.DEFAULT, SWT.DEFAULT));

	}

	protected void doExport() {

	}

	protected void doExit() {
		getViewSite().getPage().hideView(this);
	}

	protected abstract void doCancel();

	protected abstract void doSave();

	protected abstract void doDel();

	protected abstract void doEdit();

	protected abstract void doAdd();

	protected abstract void doPrint();

	/**
	 * Create the actions.
	 */
	private void createActions() {

	}

	/**
	 * Initialize the toolbar.
	 */
	private void initializeToolBar() {
		@SuppressWarnings("unused")
		IToolBarManager toolbarManager = getViewSite().getActionBars().getToolBarManager();
	}

	/**
	 * Initialize the menu.
	 */
	private void initializeMenu() {
		@SuppressWarnings("unused")
		IMenuManager menuManager = getViewSite().getActionBars().getMenuManager();
	}

	public void initCombo() {
		CommonUtils.initCombo(combo_sex, "SEX");
		CommonUtils.initCombo(combo_whcd, "WHCD");
		CommonUtils.initCombo(combo_zfwhcd, "WHCD");
		CommonUtils.initCombo(combo_xusj, "YES_NO");
		CommonUtils.initCombo(combo_tzyc, "ZCYC");
		
		CommonUtils.initCombo(cmobo_fkjc, "ZCYC");
		CommonUtils.initCombo(combo_ggn, "ZCYC");
		
		CommonUtils.initCombo(combo_HbsAg, "YXYX");
		CommonUtils.initCombo(combo_mdsc, "YXYX");
		CommonUtils.initCombo(combo_hivsc, "YXYX");
		
		CommonUtils.initCombo(cmobo_gwpd, "GWPD");
		CommonUtils.initCombo(cmobo_ndb, "NDB");
	}

}
